﻿
Public Class Fisicas


    Dim DS As DataSet
    Private objtitulares As Negocios.Nfisicas


    Private Sub txtnumcuil_Validate(ByVal Cancel As Boolean)

        'Comprueba si la Hora es válida
        If IsDate(txtnumcuil.FormatProvider) = False Then

            'Opcional: podemos mostrar un mensaje
            MsgBox("Fecha errónea", vbCritical, "Validación de .....")
            Cancel = True

        End If

    End Sub

    Private Sub btnalta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnalta.Click


        Dim ogeneralNegocio As New Negocios.Nfisicas
        Dim oFisicasNegocios As New Negocios.Nfisicas
        Dim oFisicas As New Entidades.Efisicas




        If comboestado.SelectedValue = "Soltero" Then
            txtapenomcony.Enabled = True
            combotipocony.Enabled = True
            txtnumdoccony.Enabled = True
        End If

        If txtapenom.TextLength = 0 Then
            MsgBox("Debe ingresar nombre y apellido", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtapenom.Focus()
            Exit Sub
        End If
        If IsNumeric(txtapenom.Text) Then
            MsgBox("El nombre y apellido debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtapenom.Focus()
            txtapenom.Text = ""
            Exit Sub
        End If

        If txtnumdoc.TextLength = 0 Then
            MsgBox("Debe ingresar el numero de documento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumdoc.Focus()
            Exit Sub
        End If

        If Not IsNumeric(txtnumdoc.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumdoc.Focus()
            txtnumdoc.Text = ""
            Exit Sub
        End If
        If txtnumcuil.TextLength = 0 Then
            MsgBox("Debe ingresar el numero de cuil", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumcuil.Focus()
            Exit Sub
        End If

        If Not IsNumeric(txtnumcuil.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumcuil.Focus()
            txtnumcuil.Text = ""
            Exit Sub
        End If

        If Not IsNumeric(txtnumtelfijo.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelfijo.Focus()
            txtnumtelfijo.Text = ""
            Exit Sub
        End If

        If Not IsNumeric(txtnumtelmovil.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelmovil.Focus()
            txtnumtelmovil.Text = ""
            Exit Sub
        End If

        If Not IsNumeric(txtnumtelmovil.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelmovil.Focus()
            txtnumtelmovil.Text = ""
            Exit Sub
        End If

        If txtnacionalidad.TextLength = 0 Then
            MsgBox("Debe ingresar nacionalidad", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnacionalidad.Focus()
            Exit Sub
        End If
        If IsNumeric(txtnacionalidad.Text) Then
            MsgBox("El dato debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnacionalidad.Focus()
            txtnacionalidad.Text = ""
            Exit Sub
        End If

        If txtpaisnac.TextLength = 0 Then
            MsgBox("Debe ingresar el pais de nacimiento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtpaisnac.Focus()
            Exit Sub
        End If
        If IsNumeric(txtpaisnac.Text) Then
            MsgBox("El dato debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtpaisnac.Focus()
            txtpaisnac.Text = ""
            Exit Sub
        End If

        If Comboprovincia.Text = "" Then
            MsgBox("Debe seleccionar una provincia", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Comboprovincia.Focus()
            Exit Sub
        End If
        If Combodepartamento.Text = "" Then
            MsgBox("Debe seleccionar un departamento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Combodepartamento.Focus()
            Exit Sub
        End If
        If Combolocalidad.Text = "" Then
            MsgBox("Debe seleccionar una localidad", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Combolocalidad.Focus()
            Exit Sub
        End If

        If txtcp.TextLength = 0 Then
            MsgBox("Debe ingresar un C.P.", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtcp.Focus()
            Exit Sub
        End If
        If Not IsNumeric(txtcp.Text) Then
            MsgBox("El dato debe ser solo numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtcp.Focus()
            txtcp.Text = ""
            Exit Sub
        End If

        oFisicas.fechaalta = UCase(fecha.Text)
        oFisicas.apenom = UCase(txtapenom.Text)
        oFisicas.tipodoc = UCase(combotipo.SelectedValue)
        oFisicas.numdoc = UCase(txtnumdoc.Text)
        oFisicas.numcuil = UCase(txtnumcuil.Text)
        oFisicas.estadocivil = UCase(comboestado.SelectedValue)
        oFisicas.telfijo = UCase(txtnumtelfijo.Text)
        oFisicas.telmovil = UCase(txtnumtelmovil.Text)
        oFisicas.nacion = UCase(txtnacionalidad.Text)
        oFisicas.paisnac = UCase(txtpaisnac.Text)
        oFisicas.provin = UCase(Comboprovincia.Text)
        oFisicas.dep = UCase(Combodepartamento.Text)
        oFisicas.loc = UCase(Combolocalidad.Text)
        oFisicas.codpostal = UCase(txtcp.Text)
        oFisicas.domlegal = UCase(txtcalleleg.Text)
        oFisicas.numlegal = UCase(txtnumleg.Text)
        oFisicas.pisolegal = UCase(txtpisoleg.Text)
        oFisicas.dptolegal = UCase(txtdptoleg.Text)
        oFisicas.domreal = UCase(txtdptoleg.Text)
        oFisicas.numreal = UCase(txtnumre.Text)
        oFisicas.pisoreal = UCase(txtpisore.Text)
        oFisicas.dptoreal = UCase(txtdptore.Text)
        oFisicas.apenomcony = UCase(txtapenomcony.Text)
        oFisicas.tipodoccony = UCase(combotipocony.Text)
        oFisicas.numdoccony = UCase(txtnumdoccony.Text)

        Try
            If oFisicasNegocios.guardarfisicas(oFisicas) Then
                MsgBox("Está seguro que desea guardar los datos?", MsgBoxStyle.YesNoCancel)

                MsgBox("Los datos se cargaron correctamente", MsgBoxStyle.MsgBoxSetForeground, "Información")
            End If
        Catch ex As Exception
            MsgBox("Carga fallida" + ex.Message, MsgBoxStyle.MsgBoxSetForeground, "Información")
        End Try

        DGgeneral.DataSource = ogeneralNegocio.buscageneral

        txtapenom.Text = ""
        txtnumdoc.Text = ""
        txtnumtelfijo.Text = ""
        txtnumtelmovil.Text = ""
        txtnacionalidad.Text = ""
        txtpaisnac.Text = ""
        txtcp.Text = ""
        txtcalleleg.Text = ""
        txtnumleg.Text = ""
        txtpisoleg.Text = ""
        txtdptoleg.Text = ""
        txtcallere.Text = ""
        txtnumre.Text = ""
        txtpisore.Text = ""
        txtdptore.Text = ""
        txtapenomcony.Text = ""
        txtnumdoccony.Text = ""

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label30.Text = DateTime.Now

    End Sub


    Private Sub Fisicas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtcp.Enabled = False
        combotipo.Items.Add("DNI")
        combotipo.Items.Add("CI")


        With txtnumcuil
            .Mask = "##-########-#"
        End With


    Dim ogeneralNegocio As New Negocios.Nfisicas
    Dim ogeneral As New Entidades.Efisicas

        DGgeneral.DataSource = ogeneralNegocio.buscageneral

    Dim oTitularesNegocios As New Negocios.Nfisicas
        Comboprovincia.DataSource = oTitularesNegocios.comboprovin
        Comboprovincia.DisplayMember = " cod_provincia"
        Comboprovincia.ValueMember = "nombre_provincia"

        comboestado.Items.Add("Casado")
        comboestado.Items.Add("Soltero")
        comboestado.Items.Add("Divorciado")

        txtapenom.Focus()

    End Sub

    Private Sub txtapenom_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtapenom.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            combotipo.Focus()
        End If
    End Sub

    Private Sub combotipo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles combotipo.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumdoc.Focus()
        End If
    End Sub

    Private Sub comboestado_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles comboestado.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumtelfijo.Focus()
        End If
    End Sub


    Private Sub comboestado_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboestado.SelectedIndexChanged

        If comboestado.Text = "Soltero" Then
            txtapenomcony.Enabled = False
            txtnumdoccony.Enabled = False
            combotipocony.Enabled = False
        Else

            If comboestado.Text = "Casado" Then
                txtapenomcony.Enabled = True
                txtnumdoccony.Enabled = True
                combotipocony.Enabled = True
            Else
                If comboestado.Text = "Divorciado" Then
                    txtapenomcony.Enabled = False
                    txtnumdoccony.Enabled = False
                    combotipocony.Enabled = False
                Else
                End If
            End If
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncostos.Click
        Costos.Show()
    End Sub

    Private Sub Combodepartamento_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Combodepartamento.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            Combolocalidad.Focus()
        End If
    End Sub

    Private Sub Combodepartamento_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combodepartamento.SelectedIndexChanged
        Dim olocalidadNegocio As New Negocios.Nfisicas
        Dim otipo As New Entidades.Efisicas

        Combolocalidad.DataSource = olocalidadNegocio.comboloc(Combodepartamento.Text)
        Combolocalidad.DisplayMember = "cod_localidad"
        Combolocalidad.ValueMember = "nombre_localidad"

    End Sub

    Private Sub Comboprovincia_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Comboprovincia.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            Combodepartamento.Focus()
        End If
    End Sub

    Private Sub Comboprovincia_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Comboprovincia.SelectedIndexChanged
        Dim odepartNegocio As New Negocios.Nfisicas
        Dim otipo As New Entidades.Efisicas

        Combodepartamento.DataSource = odepartNegocio.combodepartamentos(Comboprovincia.Text)
        Combodepartamento.DisplayMember = "cod_departamento"
        Combodepartamento.ValueMember = "nombre_departamento"

    End Sub

    Private Sub Combolocalidad_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Combolocalidad.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtcalleleg.Focus()
        End If
    End Sub


    Private Sub Combolocalidad_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combolocalidad.SelectedIndexChanged

        txtcp.Text = Combolocalidad.DataSource.rows(Combolocalidad.SelectedIndex)("codigo_postal")

    End Sub


    Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbuscar.Click
        Dgtitulares.Visible = True

        Dim otitularesNegocio As New Negocios.Nfisicas
        Dim otitulares As New Entidades.Efisicas

        Dgtitulares.DataSource = otitularesNegocio.buscartitular(txtbuscar.Text)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim ogeneralNegocio As New Negocios.Nfisicas
        Dim resp As Integer
        If Not IsNumeric(txtnumdoc.Text) Then
            MsgBox("El numero de documento debe ser solo numerico", MsgBoxStyle.DefaultButton1, Title:="M.R.G SYSTEM")
            txtnumdoc.Focus()
            txtnumdoc.Text = ""
            Exit Sub
        End If

        If (Len(txtnumdoc.Text) = 0) Then
            MsgBox("El numero de documento es un  campo obligatorio", MsgBoxStyle.Exclamation)
            txtnumdoc.Focus()
            Exit Sub
        End If


        Dim oFisicasNegocios As New Negocios.Nfisicas
        Dim oFisicas As New Entidades.Efisicas
        oFisicas.numdoc = UCase(txtnumdoc.Text)
        Try
            resp = MsgBox("Esta seguro que desea eliminar los datos??", MsgBoxStyle.YesNo)
            If resp = 6 Then
                oFisicasNegocios.eliminarfisicas(oFisicas)
                MsgBox("La persona fisica se elimino correctamente", MsgBoxStyle.MsgBoxSetForeground, "Información")
            End If

        Catch ex As Exception
            MsgBox("La persona fisica no se pudo eliminar" + ex.Message, MsgBoxStyle.MsgBoxSetForeground, "Información")
        End Try

        DGgeneral.DataSource = ogeneralNegocio.buscageneral
        txtapenom.Text = ""
        txtnumdoc.Text = ""
        txtnumtelfijo.Text = ""
        txtnumtelmovil.Text = ""
        txtnacionalidad.Text = ""
        txtpaisnac.Text = ""
        txtcp.Text = ""
        txtcalleleg.Text = ""
        txtnumleg.Text = ""
        txtpisoleg.Text = ""
        txtdptoleg.Text = ""
        txtcallere.Text = ""
        txtnumre.Text = ""
        txtpisore.Text = ""
        txtdptore.Text = ""
        txtapenomcony.Text = ""
        txtnumdoccony.Text = ""

    End Sub

    Private Sub btnmodificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmodificar.Click
        Dim ogeneralNegocio As New Negocios.Nfisicas


        If comboestado.SelectedValue = "Soltero" Then
            txtapenomcony.Enabled = True
            combotipocony.Enabled = True
            txtnumdoccony.Enabled = True

        End If

        If txtapenom.TextLength = 0 Then
            MsgBox("Debe ingresar nombre y apellido", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtapenom.Focus()
            Exit Sub
        End If
        If IsNumeric(txtapenom.Text) Then
            MsgBox("El nombre y apellido debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtapenom.Focus()
            txtapenom.Text = ""
            Exit Sub
        End If

        If txtnumdoc.TextLength = 0 Then
            MsgBox("Debe ingresar el numero de documento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumdoc.Focus()
            Exit Sub
        End If
        If Not IsNumeric(txtnumdoc.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumdoc.Focus()
            txtnumdoc.Text = ""
            Exit Sub
        End If
        If txtnumcuil.TextLength = 0 Then
            MsgBox("Debe ingresar el numero de cuil", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumcuil.Focus()
            Exit Sub
        End If
        'If Not IsNumeric(txtnumcuil.Text) Then
        '    MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
        '    txtnumcuil.Focus()
        '    txtnumcuil.Text = ""
        '    Exit Sub
        'End If

        If Not IsNumeric(txtnumtelfijo.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelfijo.Focus()
            txtnumtelfijo.Text = ""
            Exit Sub
        End If

        If Not IsNumeric(txtnumtelmovil.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelmovil.Focus()
            txtnumtelmovil.Text = ""
            Exit Sub
        End If
        If Not IsNumeric(txtnumtelmovil.Text) Then
            MsgBox("El dato debe ser numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnumtelmovil.Focus()
            txtnumtelmovil.Text = ""
            Exit Sub
        End If

        If txtnacionalidad.TextLength = 0 Then
            MsgBox("Debe ingresar nacionalidad", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnacionalidad.Focus()
            Exit Sub
        End If
        If IsNumeric(txtnacionalidad.Text) Then
            MsgBox("El dato debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtnacionalidad.Focus()
            txtnacionalidad.Text = ""
            Exit Sub
        End If

        If txtpaisnac.TextLength = 0 Then
            MsgBox("Debe ingresar el pais de nacimiento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtpaisnac.Focus()
            Exit Sub
        End If
        If IsNumeric(txtpaisnac.Text) Then
            MsgBox("El dato debe ser solo texto", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtpaisnac.Focus()
            txtpaisnac.Text = ""
            Exit Sub
        End If

        If Comboprovincia.Text = "" Then
            MsgBox("Debe seleccionar una provincia", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Comboprovincia.Focus()
            Exit Sub
        End If
        If Combodepartamento.Text = "" Then
            MsgBox("Debe seleccionar un departamento", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Combodepartamento.Focus()
            Exit Sub
        End If
        If Combolocalidad.Text = "" Then
            MsgBox("Debe seleccionar una localidad", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            Combolocalidad.Focus()
            Exit Sub
        End If

        If txtcp.TextLength = 0 Then
            MsgBox("Debe ingresar un C.P.", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtpaisnac.Focus()
            Exit Sub
        End If
        If Not IsNumeric(txtcp.Text) Then
            MsgBox("El dato debe ser solo numerico", MsgBoxStyle.DefaultButton1, Title:="ERROR")
            txtcp.Focus()
            txtcp.Text = ""
            Exit Sub
        End If
        Dim oFisicasNegocios As New Negocios.Nfisicas
        Dim oFisicas As New Entidades.Efisicas

        oFisicas.fechaalta = UCase(fecha.Text)
        oFisicas.apenom = UCase(txtapenom.Text)
        oFisicas.tipodoc = UCase(combotipo.SelectedValue)
        oFisicas.numdoc = UCase(txtnumdoc.Text)
        oFisicas.numcuil = UCase(txtnumcuil.Text)
        oFisicas.estadocivil = UCase(comboestado.SelectedValue)
        oFisicas.telfijo = UCase(txtnumtelfijo.Text)
        oFisicas.telmovil = UCase(txtnumtelmovil.Text)
        oFisicas.nacion = UCase(txtnacionalidad.Text)
        oFisicas.paisnac = UCase(txtpaisnac.Text)
        oFisicas.provin = UCase(Comboprovincia.Text)
        oFisicas.dep = UCase(Combodepartamento.Text)
        oFisicas.loc = UCase(Combolocalidad.Text)
        oFisicas.codpostal = UCase(txtcp.Text)
        oFisicas.domlegal = UCase(txtcalleleg.Text)
        oFisicas.numlegal = UCase(txtnumleg.Text)
        oFisicas.pisolegal = UCase(txtpisoleg.Text)
        oFisicas.dptolegal = UCase(txtdptoleg.Text)
        oFisicas.domreal = UCase(txtcallere.Text)
        oFisicas.numreal = UCase(txtnumre.Text)
        oFisicas.pisoreal = UCase(txtpisore.Text)
        oFisicas.dptoreal = UCase(txtdptore.Text)
        oFisicas.apenomcony = UCase(txtapenomcony.Text)
        oFisicas.tipodoccony = UCase(combotipocony.Text)
        oFisicas.numdoccony = UCase(txtnumdoccony.Text)

        Try
            If oFisicasNegocios.guardarfisicas(oFisicas) Then
                MsgBox("Está seguro que desea modificar los datos?", MsgBoxStyle.YesNoCancel)

                MsgBox("Los datos se modificaron correctamente", MsgBoxStyle.MsgBoxSetForeground, "Información")
            End If
        Catch ex As Exception
            MsgBox("Modificion fallida" + ex.Message, MsgBoxStyle.MsgBoxSetForeground, "Información")
        End Try
        DGgeneral.DataSource = ogeneralNegocio.buscageneral
        txtapenom.Text = ""
        txtnumdoc.Text = ""
        txtnumtelfijo.Text = ""
        txtnumtelmovil.Text = ""
        txtnacionalidad.Text = ""
        txtpaisnac.Text = ""
        txtcp.Text = ""
        txtcalleleg.Text = ""
        txtnumleg.Text = ""
        txtpisoleg.Text = ""
        txtdptoleg.Text = ""
        txtcallere.Text = ""
        txtnumre.Text = ""
        txtpisore.Text = ""
        txtdptore.Text = ""
        txtapenomcony.Text = ""
        txtnumdoccony.Text = ""

    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Juridicas.Show()
    End Sub


    Private Sub Dgtitulares_DoubleClick1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Dgtitulares.DoubleClick
        Dim i As Integer
        i = Dgtitulares.CurrentCell.RowIndex

        txtapenom.Text = Dgtitulares.Rows(i).Cells(0).Value
        combotipo.Text = Dgtitulares.Rows(i).Cells(1).Value
        txtnumdoc.Text = Dgtitulares.Rows(i).Cells(2).Value
        txtnumcuil.Text = Dgtitulares.Rows(i).Cells(3).Value
        comboestado.Text = Dgtitulares.Rows(i).Cells(4).Value
        txtnumtelfijo.Text = Dgtitulares.Rows(i).Cells(5).Value
        txtnumtelmovil.Text = Dgtitulares.Rows(i).Cells(6).Value
        txtnacionalidad.Text = Dgtitulares.Rows(i).Cells(7).Value
        txtpaisnac.Text = Dgtitulares.Rows(i).Cells(8).Value
        Comboprovincia.Text = Dgtitulares.Rows(i).Cells(9).Value
        Combodepartamento.Text = Dgtitulares.Rows(i).Cells(10).Value
        Combolocalidad.Text = Dgtitulares.Rows(i).Cells(11).Value
        txtcp.Text = Dgtitulares.Rows(i).Cells(12).Value
        txtcalleleg.Text = Dgtitulares.Rows(i).Cells(13).Value
        txtnumleg.Text = Dgtitulares.Rows(i).Cells(14).Value
        txtpisoleg.Text = Dgtitulares.Rows(i).Cells(15).Value
        txtdptoleg.Text = Dgtitulares.Rows(i).Cells(16).Value
        txtcallere.Text = Dgtitulares.Rows(i).Cells(17).Value
        txtnumre.Text = Dgtitulares.Rows(i).Cells(18).Value
        txtpisore.Text = Dgtitulares.Rows(i).Cells(19).Value
        txtdptore.Text = Dgtitulares.Rows(i).Cells(20).Value
        txtapenomcony.Text = Dgtitulares.Rows(i).Cells(21).Value
        combotipocony.Text = Dgtitulares.Rows(i).Cells(22).Value
        txtnumdoccony.Text = Dgtitulares.Rows(i).Cells(23).Value


    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Vendedores.Show()
    End Sub


    Private Sub txtnumdoc_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumdoc.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumcuil.Focus()
        End If
    End Sub

    Private Sub txtnumcuil_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumcuil.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            comboestado.Focus()
        End If
    End Sub

    Private Sub txtnumtelfijo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumtelfijo.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumtelmovil.Focus()
        End If
    End Sub

    Private Sub txtnumtelmovil_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumtelmovil.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnacionalidad.Focus()
        End If
    End Sub

    Private Sub txtnacionalidad_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnacionalidad.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtpaisnac.Focus()
        End If
    End Sub

    Private Sub txtpaisnac_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpaisnac.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            Comboprovincia.Focus()
        End If
    End Sub

    Private Sub txtcalleleg_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcalleleg.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumleg.Focus()
        End If
    End Sub

    Private Sub txtnumleg_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumleg.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtpisoleg.Focus()
        End If
    End Sub

    Private Sub txtpisoleg_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpisoleg.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtdptoleg.Focus()
        End If
    End Sub

    Private Sub txtdptoleg_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtdptoleg.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtcallere.Focus()
        End If
    End Sub

    Private Sub txtcallere_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcallere.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumre.Focus()
        End If
    End Sub

    Private Sub txtnumre_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumre.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtpisore.Focus()
        End If
    End Sub

    Private Sub txtpisore_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpisore.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtdptore.Focus()
        End If
    End Sub

    Private Sub txtdptore_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtdptore.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtapenomcony.Focus()
        End If
    End Sub

    Private Sub txtapenomcony_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtapenomcony.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            combotipocony.Focus()
        End If
    End Sub
    
    Private Sub combotipocony_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles combotipocony.KeyPress
        If e.KeyChar = ChrW(Keys.Enter) Then
            txtnumdoccony.Focus()
        End If
    End Sub

End Class